<?php

namespace App\Http\Requests\App;

use App\Http\Requests\ApiRequest;
use Illuminate\Foundation\Http\FormRequest;

/**
 * @property string account
 * @property string password
 * @property string imei - deprecated 机器唯一编码，已由后台机器账号开通时填写
 * @property string mac - deprecated 机器唯一编码，已由后台机器账号开通时填写
 * @property string longitude
 * @property string latitude
 * @property string|null language
 * @property string|null device_spec_code
 */
class LoginRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'account'          => 'required|string|max:'.self::MAX_STRING,
            'password'         => 'required|string|min:6|max:'.self::MAX_STRING,
            'longitude'        => 'nullable|string',
            'latitude'         => 'nullable|string',
            'language'         => 'nullable|string|max:'.self::MAX_STRING,
            'device_spec_code' => 'nullable|string|max:'.self::MAX_STRING,

//            'imei'      => 'nullable|string',
//            'mac'       => 'nullable|string',
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'account.*'   => '机器账号必须填写',
//            'password.*'  => '机器账号密码必须填写',
//            'imei.*'      => '机器的IMEI',
//            'mac.*'       => '机器的mac地址',
//            'longitude.*' => '机器的经度地址',
//            'latitude.*'  => '机器的维度地址',
//        ];
//    }
}
